home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / debugger / ddd-1.000 / ddd-1 / ddd-1.4b / ddd / BoxGraphN.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-04  |  3.0 KB  |  121 lines

  1. // $Id: BoxGraphN.h,v 1.4 1996/01/04 16:25:22 zeller Exp $
  2. // BoxGraphNode class: RegionGraphNode with box
  3.  
  4. // Copyright (C) 1995 Technische Universitaet Braunschweig, Germany.
  5. // Written by Andreas Zeller (zeller@ips.cs.tu-bs.de).
  6. // 
  7. // This file is part of the DDD Library.
  8. // 
  9. // The DDD Library is free software; you can redistribute it and/or
  10. // modify it under the terms of the GNU Library General Public
  11. // License as published by the Free Software Foundation; either
  12. // version 2 of the License, or (at your option) any later version.
  13. // 
  14. // The DDD Library is distributed in the hope that it will be useful,
  15. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  17. // See the GNU Library General Public License for more details.
  18. // 
  19. // You should have received a copy of the GNU Library General Public
  20. // License along with the DDD Library -- see the file COPYING.LIB.
  21. // If not, write to the Free Software Foundation, Inc.,
  22. // 675 Mass Ave, Cambridge, MA 02139, USA.
  23. // 
  24. // DDD is the data display debugger.
  25. // For details, see the DDD World-Wide-Web page, 
  26. // `http://www.cs.tu-bs.de/softech/ddd/',
  27. // or send a mail to the DDD developers at `ddd@ips.cs.tu-bs.de'.
  28.  
  29. #ifndef _Nora_BoxGraphNode_h
  30. #define _Nora_BoxGraphNode_h
  31.  
  32. #ifdef __GNUG__
  33. #pragma interface
  34. #endif
  35.  
  36.  
  37. #include "RegionGN.h"
  38. #include "Box.h"
  39. #include "MarkBox.h"
  40.  
  41. class BoxGraphNode: public RegionGraphNode {
  42. public:
  43.     DECLARE_TYPE_INFO
  44.  
  45. private:
  46.     Box *_box;         // the box
  47.     MarkBox *_highlight; // box to be highlighted when selected
  48.  
  49. protected:
  50.     // Draw
  51.     virtual void forceDraw(Widget w, 
  52.                const BoxRegion& exposed, 
  53.                const GraphGC& gc) const;
  54.  
  55.     // MARK is a MarkBox in SRC.  Find equivalent box in DUP.
  56.     MarkBox *find_mark(Box *dup, Box *src, Box *mark);
  57.  
  58.     // Copy Constructor
  59.     BoxGraphNode(const BoxGraphNode& node);
  60.  
  61. public:
  62.     // Constructor
  63.     BoxGraphNode(Box *b, const BoxPoint& initialPos = BoxPoint(), 
  64.          MarkBox *h = 0):
  65.     RegionGraphNode(initialPos, b->size()),
  66.     _box(b->link()),
  67.         _highlight(h)
  68.     {}
  69.  
  70.     GraphNode *dup() const
  71.     {
  72.     return new BoxGraphNode(*this);
  73.     }
  74.  
  75.     // Destructor
  76.     virtual ~BoxGraphNode()
  77.     {
  78.     if (_highlight)
  79.         _highlight->unlink();
  80.     _box->unlink();
  81.     }
  82.  
  83.     // Attributes
  84.     Box *box() const           { return _box; }
  85.     MarkBox *highlight() const { return _highlight; }
  86.     virtual string str() const { return box()->str(); }
  87.  
  88.     virtual const BoxRegion& highlightRegion(const GraphGC& gc) const
  89.     { 
  90.     if (_highlight)
  91.         return _highlight->__region();
  92.     else
  93.         return RegionGraphNode::highlightRegion(gc);
  94.     }
  95.  
  96.     // Modify
  97.     // Set the highlight box.
  98.     // The highlight box must be a child of the displayed box.
  99.     void setHighlight(MarkBox *b = 0)
  100.     {
  101.     _highlight = b;
  102.     }
  103.  
  104.     // Set the box.
  105.     void setBox(Box *b)
  106.     {
  107.     setHighlight(0);
  108.  
  109.     Box *old = _box;
  110.     _box = b->link();
  111.     old->unlink();
  112.     resize(b->size());
  113.     }
  114.  
  115.  
  116.     // Print
  117.     virtual void _print(ostream& os, const GraphGC& gc) const;
  118. };
  119.  
  120. #endif
  121.